$(document).ready(function()
	{
		calendarHandler.init();
		makeCal.init();
		gotoFestival();
		
		//当参数t=t时，为“今天几号”查询，此时不显示登录、添加按钮也不进行登录
		var istoday = getUrlParam("t");
		if(istoday=='t')	
		{
			$('#cal_365riliUser').hide();
			$('#cal_plusbutton').hide();
		}
// ToDo		
	});
	
	function getUrlParam(param) {
		var hrefstr, pos, parastr, para, tempstr;
		hrefstr = window.location.href;
		pos = hrefstr.indexOf("?");
		end = hrefstr.indexOf("#");
		if (end < 0)
			end = hrefstr.length;
		parastr = hrefstr.substring(pos + 1, end);
		para = parastr.split("&");
		tempstr = "";
		for (i = 0; i < para.length; i++) {
			tempstr = para[i];
			pos = tempstr.indexOf("=");
			if (tempstr.substring(0, pos) == param) {
				return tempstr.substring(pos + 1);
			}
		}
		return null;
	}
	
	function gotoFestival(){
		//get festival parameter
		var search = window.location.search.substring(1); //alert(search);
		var pairs = search.split('&'); //alert(pairs.length);
		var value = '';
		for(var i in pairs){ //alert(i);
			var kv = pairs[i].split('='); //alert(kv[0]); alert(kv[1]);
			if(kv.length == 2 && kv[0] == 's_param'){
				var param = decodeURIComponent(kv[1]).split('=');
				if(param.length == 2){
					value = param[1];
				}
				break;
			}
		}
		
		switch(value){
			case 'yuandan' : $("#festival_select_selecter div:nth-child(1)").trigger("click"); break;
			case 'chunjie' : $("#festival_select_selecter div:nth-child(2)").trigger("click"); break;
			case 'qingming' : $("#festival_select_selecter div:nth-child(3)").trigger("click"); break;
			case 'laodong' : $("#festival_select_selecter div:nth-child(4)").trigger("click"); break;
			case 'duanwu' : $("#festival_select_selecter div:nth-child(5)").trigger("click"); break;
			case 'zhongqiu' : $("#festival_select_selecter div:nth-child(6)").trigger("click"); break;
			case 'guoqing' : $("#festival_select_selecter div:nth-child(7)").trigger("click"); break;
			default : break;
 		}
	}
